package com.ilancuo.thread;

import java.util.stream.IntStream;

/**
 * 继承Thread
 * 2020-01-10
 */
public class CreateThreadByExtendsThread extends Thread {

    @Override
    public void run() {
        IntStream.rangeClosed(1, 10).forEach(i -> System.out.println(Thread.currentThread().getName() + " " + i));
    }

    public static void main(String[] args) {
        CreateThreadByExtendsThread thread1 = new CreateThreadByExtendsThread();
        CreateThreadByExtendsThread thread2 = new CreateThreadByExtendsThread();
        CreateThreadByExtendsThread thread3 = new CreateThreadByExtendsThread();

        thread1.start();
        thread2.start();
        thread3.start();
    }
}
